/*
package com.kaichaohulian.baocms;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.kaichaohulian.baocms.app.MyApplication;
import com.kaichaohulian.baocms.fragment.ContactListFragment;
import com.kaichaohulian.baocms.fragment.DiscoverFragment;
import com.kaichaohulian.baocms.fragment.HomeFragment;
import com.kaichaohulian.baocms.fragment.ProFileFragment;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

*/
/**
 * 主界面
 * Created by ljl on 2016/12/11.
 *//*

@SuppressLint("ValidFragment")
public class MainActivity_zhantie extends FragmentActivity {

    @BindView(R.id.content)
    FrameLayout content;
    @BindView(R.id.ib_weixin)
    ImageView ibWeixin;
    @BindView(R.id.tv_weixin)
    TextView tvWeixin;
    @BindView(R.id.unread_msg_number)
    TextView unreadMsgNumber;
    @BindView(R.id.re_weixin)
    RelativeLayout reWeixin;
    @BindView(R.id.ib_contact_list)
    ImageView ibContactList;
    @BindView(R.id.tv_contact_list)
    TextView tvContactList;
    @BindView(R.id.unread_address_number)
    TextView unreadAddressNumber;
    @BindView(R.id.re_contact_list)
    RelativeLayout reContactList;
    @BindView(R.id.ib_find)
    ImageView ibFind;
    @BindView(R.id.tv_find)
    TextView tvFind;
    @BindView(R.id.unread_discover_number)
    TextView unreadDiscoverNumber;
    @BindView(R.id.re_find)
    RelativeLayout reFind;
    @BindView(R.id.ib_profile)
    ImageView ibProfile;
    @BindView(R.id.tv_profile)
    TextView tvProfile;
    @BindView(R.id.re_profile)
    RelativeLayout reProfile;
    @BindView(R.id.main_bottom)
    LinearLayout mainBottom;
    @BindView(R.id.view_temp)
    View viewTemp;
    @BindView(R.id.ib_contact_list2)
    ImageView ibContactList2;
    @BindView(R.id.activity_main)
    LinearLayout activityMain;
    private HomeFragment homefragment;
    private ContactListFragment contactlistfragment;
    private DiscoverFragment findfragment;
    private ProFileFragment profilefragment;
    private FragmentTransaction ft;
    private long mExitTime;
    private MyApplication myApplication;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        myApplication = (MyApplication) getApplication();
        setSelect(0);
    }

    @OnClick({R.id.content, R.id.ib_weixin, R.id.tv_weixin, R.id.unread_msg_number, R.id.re_weixin, R.id.ib_contact_list, R.id.tv_contact_list, R.id.unread_address_number, R.id.re_contact_list, R.id.ib_find, R.id.tv_find, R.id.unread_discover_number, R.id.re_find, R.id.ib_profile, R.id.tv_profile, R.id.re_profile, R.id.main_bottom, R.id.view_temp, R.id.ib_contact_list2, R.id.activity_main})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.content:
                break;
            case R.id.ib_weixin:
                break;
            case R.id.tv_weixin:
                break;
            case R.id.unread_msg_number:
                break;
            case R.id.re_weixin:
                setSelect(0);
                break;
            case R.id.ib_contact_list:
                break;
            case R.id.tv_contact_list:
                break;
            case R.id.unread_address_number:
                break;
            case R.id.re_contact_list:
                setSelect(1);
                break;
            case R.id.ib_find:
                break;
            case R.id.tv_find:
                break;
            case R.id.unread_discover_number:
                break;
            case R.id.re_find:
                setSelect(2);
                break;
            case R.id.ib_profile:
                break;
            case R.id.tv_profile:
                break;
            case R.id.re_profile:
                setSelect(3);
                break;
            case R.id.main_bottom:
                break;
            case R.id.view_temp:
                break;
            case R.id.ib_contact_list2:
                break;
            case R.id.activity_main:
                break;
        }
    }



    private void setSelect(int i) {
        FragmentManager fm = getSupportFragmentManager();
        ft = fm.beginTransaction();
        reSetTab();
        hideFragment();
        switch (i) {
            case 0:
                //首页
                if (homefragment == null) {
                    homefragment = new HomeFragment();
                    ft.add(R.id.content, homefragment);
                }
//                ivHome.setImageResource(R.drawable.bid01);

                ft.show(homefragment);
                break;
            case 1:
                //投资
                if (contactlistfragment == null) {
                    contactlistfragment = new ContactListFragment(myApplication, MainActivity_zhantie.this, MainActivity_zhantie.this);
                    ft.add(R.id.content, contactlistfragment);
                }
//                ivTouzi.setImageResource(R.drawable.bid03);
                //  tvTouzi.setTextColor(UIUtils.getColor(R.color.home_back_selected));
                ft.show(contactlistfragment);
                break;
            case 2:
                //资产
                if (findfragment == null) {
                    findfragment = new DiscoverFragment(myApplication, MainActivity_zhantie.this, MainActivity_zhantie.this);
                    ft.add(R.id.content, findfragment);
                }
//                ivMe.setImageResource(R.drawable.bid05);
                // tvMe.setTextColor(UIUtils.getColor(R.color.home_back_selected));
                ft.show(findfragment);
                break;
            case 3:
                //更多
                if (profilefragment == null) {
                    profilefragment = new ProFileFragment(myApplication, MainActivity_zhantie.this, MainActivity_zhantie.this);
                    ft.add(R.id.content, profilefragment);
                }
//                ivMore.setImageResource(R.drawable.bid07);
                //  tvMore.setTextColor(UIUtils.getColor(R.color.home_back_selected));
                ft.show(profilefragment);
                break;
        }
        ft.commit();
    }


    private void reSetTab() {
//        homefragment.setImageResource(R.drawable.bid02);
//        ivTouzi.setImageResource(R.drawable.bid04);
//        ivMe.setImageResource(R.drawable.bid06);
//        ivMore.setImageResource(R.drawable.bid08);

    }


    private void hideFragment() {
        if (homefragment != null) {
            ft.hide(homefragment);
        }
        if (contactlistfragment != null) {
            ft.hide(contactlistfragment);
        }
        if (findfragment != null) {
            ft.hide(findfragment);
        }
        if (profilefragment != null) {
            ft.hide(profilefragment);
        }
    }

    */
/* private void showPopupWindow(View parent) {
        if (popWindow == null) {

            View view = LayoutInflater.from(this).inflate(R.layout.dialog_01, null);

            //LayoutParams相当于一个Layout的信息包，它封装了Layout的位置、高、宽等信息。
            popWindow = new PopupWindow(view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, true);
            initPop(view);
        }
        //设置动画效果
        popWindow.setAnimationStyle(android.R.style.Animation_Dialog);
        //获取popwindow焦点
        popWindow.setFocusable(true);
        //设置popwindow如果点击外面区域，便关闭。
        popWindow.setOutsideTouchable(true);
        popWindow.setBackgroundDrawable(new BitmapDrawable());
        //实现软键盘不自动弹出,ADJUST_RESIZE属性表示Activity的主窗口总是会被调整大小，从而保证软键盘显示空间。
        popWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
        //设置popwindow显示位置
        popWindow.showAtLocation(parent, Gravity.CENTER, 0, 0);
    }

    public void initPop(View view) {
        TextView tv01 = (TextView) view.findViewById(R.id.dl_tv_01);//拍照
        TextView tv02 = (TextView) view.findViewById(R.id.dl_tv_02);//相册
        LinearLayout layout_dismiss = (LinearLayout) view.findViewById(R.id.layout_dismiss);
        gridview = (GridView) view.findViewById(gridview);
        gridview.setAdapter(new MyGridAdapter(this));

//        view2.getBackground().setAlpha(160);//0~255透明度值

        layout_dismiss.getBackground().setAlpha(230);
        final ImageView img_close = (ImageView) view.findViewById(R.id.img_close);
        img_close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                popWindow.dismiss();
            }
        });
        layout_dismiss.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                popWindow.dismiss();
            }
        });

        tv01.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {


                popWindow.dismiss();

            }
        });
        tv02.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {


                popWindow.dismiss();
            }
        });
    }
*//*


}
*/
